import dayjs from 'dayjs'
import { formatTimestamp } from '@/utils/date'

export const column = [
  {
    prop: 'className',
    label: '班级'
  },
  {
    prop: 'childName',
    label: '学生'
  },
  {
    prop: 'refundMoney',
    label: '退费金额'
  },
  {
    prop: 'refundTime',
    label: '退费时间'
  },
  {
    prop: 'refundType',
    label: '退费方式'
  },
  {
    prop: 'refundAccountId',
    label: '退费账号'
  },
  {
    prop: 'serialNumber',
    label: '退费流水号'
  },
  {
    prop: 'action',
    label: '操作'
  }
]

export const clientColumn = [
  {
    prop: 'name',
    label: '客户名称'
  },
  {
    prop: 'mobile',
    label: '电话'
  },
  {
    prop: 'classNames',
    label: '班级'
  },
  {
    prop: 'childName',
    label: '宝宝姓名'
  },
  {
    prop: 'birthday',
    label: '宝宝生日',
    render: (row) => dayjs(row.birthday).format('YYYY/MM/DD')
  },
  {
    prop: 'month',
    label: '宝宝月龄'
  },
  {
    prop: 'relationship',
    label: '关系'
  }
]

export const seachConfigClient = (classes) => {
  return [
    {
      key: 'classId',
      label: '班级',
      type: 'select',
      fieldProps: {
        options: classes,
        props: { value: 'id', label: 'name' }
      }
    },
    {
      key: 'name',
      label: '学生姓名'
    }
  ]
}

export const productColumn = [
  {
    prop: 'productName',
    label: '产品名称'
  },
  {
    prop: 'count',
    label: '数量'
  },
  {
    prop: 'practicalAmount',
    label: '单价'
  },
  {
    prop: 'practicalTotalAmount',
    label: '总金额'
  }
]

export const accountInfoColumn = [
  {
    prop: 'title',
    label: '退费项目'
  },
  {
    prop: 'refundAmount',
    label: '退费金额'
  },
  {
    prop: 'refundRemark',
    label: '退费备注'
  }
]

export const infoItems = (info) => {
  return [
    {
      label: '孩子姓名',
      key: 'childName',
      initialValue: info.childName,
      layoutCol: { sm: 24, md: 24, lg: 24 }
    },
    {
      label: '班级',
      key: 'className',
      initialValue: info.className
    },
    {
      label: '退费金额',
      key: 'refundMoney',
      initialValue: info.refundMoney
    },
    {
      label: '退费时间',
      key: 'refundTime',
      initialValue: formatTimestamp(info.refundTime)
    },
    {
      label: '退费方式',
      key: 'refundType',
      initialValue: info.refundType
    },
    {
      label: '退费账号',
      key: 'refundAccountId',
      initialValue: info.refundAccountId
    },
    {
      label: '退费流水',
      key: 'serialNumber',
      initialValue: info.serialNumber
    }
  ]
}
